
//_object_write=document.write;
//document.write=function(str){if(-1!=str.indexOf('me'+'nhut'+'ong')) return;_object_write(str);}

function maxLen(obj,len)
{
	if(arguments.length!=3){
		obj	=	document.getElementById(obj);
		obj.onblur=obj.onfocus=obj.onkeydown=function(){maxLen(obj,len,true);};
	}
	else if(len && obj.value.length>len){
		obj.value=obj.value.substr(0,len);
	}
}

function I(id)
{
	return document.getElementById(id);
}
function intv(o)
{
	return isNaN(_=parseInt(o))?0:_;
}
function findmixed(pid1,pid2,cid,cname,mult)
{
	$("#"+cid).html('');
	if(I(pid1) && I(pid2) && (!intv($("#"+pid1).val()) || !intv($("#"+pid2).val())))
		return;
	$.get(URL_FINDMIXED.replace('PID',intv($("#"+pid1).val())+','+intv($("#"+pid2).val())), function(data){
		if(data.mixed)
		{
			ht	= "";
			if(mult=='1')
			{
				for(i in data.mixed){
					ht	+= "<nobr><input type='checkbox' name='"+cname+"[]' id='" +cid+data.mixed[i].hid
						+"' value='"+data.mixed[i].hid+"' /><label for='"+cid+data.mixed[i].hid+"'>"
						+data.mixed[i].title+"</label></nobr> ";
				}
			}
			else
			{
				ht	+= "<option value=''>----</option>";
				for(i in data.mixed){
					ht	+= "<option value='"+data.mixed[i].hid+"'>"+data.mixed[i].title+"</option>";
				}
			}
			$("#"+cid).html(ht);
		}
	});
}

